class FrequencyTracker
{
public:
    void add(int number)
    {
        int originFreq = numCount[number];
        if (freqCount[originFreq] > 0)
        {
            --freqCount[originFreq];
        }
        ++numCount[number];
        ++freqCount[originFreq + 1];
    }

    void deleteOne(int number)
    {
        if (numCount[number] > 0)
        {
            int freq = numCount[number];
            --freqCount[freq];
            ++freqCount[freq - 1];
            --numCount[number];
        }
    }

    bool hasFrequency(int frequency)
    {
        return freqCount[frequency] > 0;
    }

private:
    unordered_map<int, int> numCount;
    unordered_map<int, int> freqCount;
};

/**
 * Your FrequencyTracker object will be instantiated and called as such:
 * FrequencyTracker* obj = new FrequencyTracker();
 * obj->add(number);
 * obj->deleteOne(number);
 * bool param_3 = obj->hasFrequency(frequency);
 */